using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using WindowsPhoneGame1.Shapes;
using Microsoft.Xna.Framework;

namespace WindowsPhoneGame1.LevelItems
{
    public class Wheel : LevelItem
    {
        private float rotation;
        private float rotationSpeed;
        private Car car;

        public Wheel(PointF position, Texture2D texture, Shape collisionShape, Car car)
            : base(position, collisionShape, texture)
        {
            this.car = car;
        }

        public void Update(GameTime gameTime, PointF position, float rotationSpeed)
        {
           // this.Position = new PointF(position.X + this.Position.X, position.Y + this.Position.Y);
            this.rotationSpeed = rotationSpeed;
            rotation += rotationSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        }

        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, PointF position, Game1 game)
        {
            game.SpriteBatch.Draw(
                texture,
                new Vector2(Position.X + texture.Width / 2f,
                    Position.Y + game.GraphicsDevice.Viewport.Height - CollisionShape.Bounds.Height - texture.Height / 4f)
                    + VIEW_OFFSET,
                texture.Bounds,
                Color.White,
                rotation,
                new Vector2(texture.Width / 2f, texture.Height / 2f),
                1,
                SpriteEffects.None,
                0);
        }
    }
}
